package modelLayer;
import java.util.ArrayList;

/**
 * LeverandoerContainer indeholder alle leverandøer.
 * 
 * @author (Gruppe 2. Jonas, Danny, Kasper, Bruno & Jesper) 
 * @version (17/12-2012)
 */
public class LeverandoerContainer
{
    // instance variables - replace the example below with your own
    private ArrayList<Leverandoer> leverandoers;

    /**
     * Constructor for objects of class LeverandoerContainer
     */
    public LeverandoerContainer()
    {
        leverandoers = new ArrayList<Leverandoer>();

    }
    
    /**
     * tilføjer leverandøer
     */
    void tilfoejLeverandoer(Leverandoer l)
    {
        leverandoers.add(l);
    }
    
    /**
     * sletter leverandøer via adresse
     */
    public void sletLeverandoer(String adresse)
    {
        int i = 0;
        boolean found = false;
        while(i < leverandoers.size() && !found)
        {
            if(leverandoers.get(i).getLeverandoerAdresse().equals(adresse))
            {
                found = true;
                leverandoers.remove(i);
            }
            else 
            {
                i++;
            }
        }
    }
}
    



